package com.xqkad.myplayer.activity;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

public class LogActivity extends AppCompatActivity {
    public static final String TAG = "mytag";
    private static boolean D = false;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        baselog("ac create");
    }

    @Override
    protected void onStart() {
        super.onStart();
        baselog("ac start");
    }

    @Override
    protected void onResume() {
        super.onResume();
        baselog("ac resume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        baselog("ac pause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        baselog("ac stops");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        baselog("ac destroy");
    }

    public static void log(String s){
        log(s,false);
    }

    public static void log(String s, boolean threadName){
        if(threadName)
            Log.d("mytag",Thread.currentThread().getName()+" "+s);
        else
            Log.d("mytag",""+s);
    }

    public static void baselog(String s){
        if(D)
            log(s);
    }
}
